<?php
namespace app\common\model;
use think\Model;
use fast\Cols;
class TeacherClasses extends Model
{
		public static function init(){
				self::event('after_insert', function($row){});
				self::event('after_update', function($row){});
				self::event('after_delete', function($row){});
		}
		public function exists($teacherid=0,$classesid=0){
				$con = array();
				$con['teacherid'] = array('eq',$teacherid);
				$con['classesid'] = array('eq',$classesid);
				$list = $this->where($con)->select();
				return count($list>0)?1:0;
		}
		public function getTeacherByClasses($classesid=0){
				$con = array();
				$con['classesid'] = array('eq',$classesid);
				$list = $this->where($con)->select();
				return $list;
		}
		public function getClassesByTeacher($teacherid=0){
				$con = array();
				$con['teacherid'] = array('eq',$teacherid);
				$list = $this->where($con)->select();
				return $list;
		}
}
?>
